package com.rh.number.service;


import com.rh.number.common.ApiResult;
import com.rh.number.common.BatchOperationResult;
import com.rh.number.dto.*;
import com.rh.number.exception.BusinessException;
import com.rh.number.exception.EmptyResultException;
import com.rh.number.exception.FileParseException;
import com.rh.number.common.PageResult;
import com.rh.number.entity.numberEntity;
import com.rh.number.exception.ResourceNotFoundException;
import jakarta.validation.Valid;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Set;

public interface NumberService {

    PageResult<numberEntity> selectByCondition(numberEntity condition, BatchQueryDto batchQuery, int pageNum, int pageSize);
     List<numberEntity> exportExcel(ExcelExportParam condition);

    // 单条插入
    void insert(Number number);

    // 批量插入（可选）
    void batchInsert(List<numberEntity> numbers);

    Set<Long> selectByNum(List<Long> nums);
    List<numberEntity> exportByCondition(numberEntity condition);

    List<numberEntity> batchQueryByFile(MultipartFile file) throws IOException;
    BatchOperationResult batchActivate(MultipartFile file)
            throws FileParseException, EmptyResultException;
    BatchOperationResult batchDeactivate(MultipartFile file)
            throws FileParseException, EmptyResultException;
    BatchOperationResult batchUpdate(List<Long> ids, List<String> nums, Map<String, Object> updateFields);
    void updateNumber(Long id, OneNumberUpdateDTO dto) throws ResourceNotFoundException;
    List<numberEntity> batchExportByIds(List<Integer> ids)
            throws IllegalArgumentException, BusinessException;

    /**
     * 单条删除
     * @param id 要删除的号码记录ID
     * @return 操作结果（带消息）
     */
    ApiResult<Void> deleteNumber(Integer id);

    /**
     * 批量删除
     * @param ids 要删除的ID列表
     * @return 删除统计结果（带成功数）
     */
    ApiResult<Void> batchDeleteNumbers(List<Integer> ids);

    void batchFullUpdate(List<Long> ids, NumberUpdateData updateData);

    ApiResult<?> insertNumber(@Valid numberEntity entity);
}